#import <UIKit/UIKit.h>

#import "FWApplication.h"


extern NSString* const FWDetailListViewFieldTitle;
extern NSString* const FWDetailListViewFieldMessage;
extern NSString* const FWDetailListViewFieldValue;
extern NSString* const FWDetailListViewFieldNoBold;
extern NSString* const FWDetailListViewFieldSize;
extern NSString* const FWDetailListViewFieldIcon;
extern NSString* const FWDetailListViewFieldLines;
extern NSString* const FWDetailListViewFieldColor;
extern NSString* const FWDetailListViewFieldBGColor;
extern NSString* const FWDetailListViewFieldProgress;
extern NSString* const FWDetailListViewFieldSwitch;
extern NSString* const FWDetailListViewFieldSelected;


@protocol FWDetailListViewDelegate <NSObject>

- (NSArray*)dataForIndex:(NSInteger)i list:(NSArray*)list database:(NSString*)dbpath application:(FWApplication*)application;


@optional

- (BOOL)cancelClicked:(FWApplication*)application sections:(NSArray*)sections;
- (BOOL)doneClicked:(FWApplication*)application sections:(NSArray*)sections;
- (BOOL)selectClicked:(FWApplication*)application sections:(NSArray*)sections;

@end


@interface FWDetailListView : UIView <UITableViewDataSource, UITableViewDelegate>
{
    NSInteger index;
    NSArray* sections;
    NSString* caption;
}


@property (nonatomic, retain) id<FWDetailListViewDelegate> delegate;
@property (retain) FWApplication* application;
@property NSInteger index;
@property (retain) NSArray* list;
@property (nonatomic, retain) NSString* caption;
@property (retain) UITableView* view;
@property (retain) UISegmentedControl* navControl;
@property (retain) UINavigationBar* navBar;
@property (nonatomic, retain) NSArray* sections;


- (id)initWithFrame:(CGRect)r list:(NSArray*)l index:(NSInteger)i application:(FWApplication*)app delegate:(id<FWDetailListViewDelegate>)d;
- (id)initWithFrame:(CGRect)r list:(NSArray*)l index:(NSInteger)i caption:(NSString*)caption application:(FWApplication*)app delegate:(id<FWDetailListViewDelegate>)d;
- (void)dealloc;

- (void)buildPreview:(CGRect)rect;

- (void)reloadData:(BOOL)animated;

@end
